// @ts-nocheck
/**
 * @Date: 2022-03-10 20:15:46
 * @LastEditors: sailornpg
 * @LastEditTime: 2022-03-10 21:07:54
 * @FilePath: \zhihuReal\routes\question.js
 * @Description: 问题路由
 */
const router = require('koa-router')()
router.prefix('/question')
const {
    auth
} = require('../middlewares/auth')
//控制器
const {
    questionList,
    oneQuestion,
    createQuestion,
    updateQuestion,
    removeQuestion,
} = require('../controllers/questionCtl')
const {
    cheackQuestionExist,
    cheackQuestionOwner
} = require('../middlewares/cheack')
//获取问题列表
router.get('/', questionList)
//获取单个话题
router.get('/:id', cheackQuestionExist, oneQuestion)
//创建问题
router.post('/', auth, createQuestion)
//更新问题
router.patch('/:id', auth, cheackQuestionExist, cheackQuestionOwner, updateQuestion)
//获取问题粉丝
//  router.get('/:id/followerList', cheackQuestionExist, topicFollowerList)
//删除问题
router.delete('/:id', auth, cheackQuestionExist, cheackQuestionOwner, removeQuestion)
module.exports = router